package com.inviteOrder.service;

import com.inviteOrder.state.*;

/**
 * @author 大忽悠
 * @create 2022/10/17 10:59
 */
public class InviteService {

    /**
     * TODO: 这里将业务流程进行了大幅度删减,实际业务不会那么简单
     * 邀请返奖服务
     * @param uid
     */
    public void sendRewardForInvite(Long uid){
        Request request = new Request(uid);
        RewardStateContext rewardStateContext = new RewardStateContext();
        //返奖中....
        rewardStateContext.setRewardState(new RewardingState());
        rewardStateContext.echo(request);
        //返奖成功
        if(rewardStateContext.resultFlag()){
            rewardStateContext.setRewardState(new RewardingSuccess());
            rewardStateContext.echo(request);
        }else {
            rewardStateContext.setRewardState(new RewardingFailure());
            rewardStateContext.echo(request);
        }
    }
}
